package com.exam.qc.controller;

import com.exam.qc.model.Quality;
import com.exam.qc.model.ReturnVo;
import com.exam.qc.service.QualityService;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/quality")
public class QualityController {

    @Resource
    private QualityService qualityService;


    /**
     * 质检操作接口
     * @param quality
     * @return
     */

    @RequestMapping(value = "/save",consumes = MediaType.APPLICATION_JSON_VALUE,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ReturnVo saveQuality(@RequestBody Quality quality){
        Integer retVal = qualityService.addQuality(quality);

        if (retVal > 0) {
            return ReturnVo.success("保存质检结果成功！");
        } else {
            return ReturnVo.success("保存质检结果失败！");
        }
    }



}
